package com.app114.app.android.rk;

import android.app.Application;

import com.app114.app.android.rk.conf.Conf;
import com.app114.app.android.rk.utils.DeviceUtil;
import com.app114.app.android.rk.utils.SharedPrefsUtil;
import com.app114.app.android.rk.utils.UmengUtil;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.WXAPIFactory;

public class App extends Application {
	@Override
	public void onCreate() {
		super.onCreate();
		UmengUtil.Debug();
		String pimei = SharedPrefsUtil.getValue(getApplicationContext(), "imei", "");
		String pimsi = SharedPrefsUtil.getValue(getApplicationContext(), "imsi", "");
		String imei = DeviceUtil.getIMEI(this);
		String imsi = DeviceUtil.getIMSI(this);
		if (!pimei.equals(imei)) {
			SharedPrefsUtil.putValue(getApplicationContext(), "imei", imei);
			UmengUtil.onEvent(this, Conf.EVENT_DEVICE_IMEI, imei);
		}
		if (!pimsi.equals(imsi)) {
			SharedPrefsUtil.putValue(getApplicationContext(), "imsi", imsi);
			UmengUtil.onEvent(this, Conf.EVENT_DEVICE_IMSI, imsi);
		}

		IWXAPI api = WXAPIFactory.createWXAPI(this, Conf.APP_ID, false);
		api.registerApp(Conf.APP_ID);

	}
}
